<div class="row row-cards row-deck">
  <div class="col-2">
    <div class="card">
      <div class="card-body">
        <div class="form-group">
          <label class="form-label">门店状态</label>
          <div class="form-control-plaintext">
            <div><%= link_to "全部", admin_shops_path %></div>
            <div><%= link_to "等待审核", admin_shops_path(state: :pending) %></div>
            <div><%= link_to "正常营业", admin_shops_path(state: :opening) %></div>
            <div><%= link_to "暂停营业", admin_shops_path(state: :closedown) %></div>
            <div><%= link_to "停止营业", admin_shops_path(state: :stop) %></div>
          </div>
        </div>
        <div class="form-group">
          <label class="form-label">是否自营</label>
          <div class="form-control-plaintext">
            <div><%= link_to "全部", admin_shops_path %></div>
            <div><%= link_to "自营", admin_shops_path(direct_sale: true) %></div>
            <div><%= link_to "非自营", admin_shops_path(direct_sale: false) %></div>
          </div>
        </div>
      </div>
    </div>
  </div>
  <div class="col-10">
    <div class="card">
      <%= form_tag admin_shops_path, method: "get" do %>
      <div class="card-header">
        <div class="col-sm-6 col-md-4">
          <div class="row cities-select">
            <div class="col-sm-6 col-md-4">
              <div class="form-group">
                <label class="form-label">省份</label>
                <%= select_tag :province_id, options_for_select(Province.select('id, name').map{ |city| [city.name, city.id] }), { prompt: "请选择", class: 'china-region-select form-control', "data-region-name" => "province_id", "data-sub-region" => "city_id" } %>
              </div>
            </div>
            <div class="col-sm-6 col-md-4">
              <div class="form-group">
                <label class="form-label">城市</label>
                <%= select_tag :city_id, nil, { class: 'china-region-select form-control', "data-region-name" => "city_id", "data-sub-region" => "district_id" } %>
              </div>
            </div>
            <div class="col-sm-6 col-md-4">
              <div class="form-group">
                <label class="form-label">县区</label>
                <%= select_tag :district_id, nil, { class: 'china-region-select form-control', "data-region-name" => "district_id" } %>
              </div>
            </div>
          </div>
        </div>
        <div class="col-sm-6 col-md-4">
          <div class="form-group">
            <label class="form-label">名字</label>
            <%= text_field_tag :name, "", { class: "form-control" } %>
          </div>
        </div>
        <div class="col-sm-6 col-md-4">
          <div class="form-group">
            <label class="form-label">&nbsp;</label>
            <%= submit_tag "搜索", { class: "btn btn-primary" } %>
          </div>
        </div>
      </div>
      <% end %>
      <table class="table table-hover table-outline table-vcenter text-nowrap card-table">
        <thead>
          <tr>
            <th class="text-center w-1"><i class="icon-people"></i></th>
            <th>ID</th>
            <th>名字</th>
            <th>电话</th>
            <th>等级</th>
            <th>状态</th>
            <th>管理员账号</th>
            <th class="text-center"><i class="icon-settings"></i></th>
          </tr>
        </thead>
        <tbody>
          <% @shops.each do |shop| %>
          <tr>
            <td class="text-center">
              <div class="avatar d-block" style="background-image: url(<%= shop.avatar.url %>)">
                <span class="avatar-status bg-green"></span>
              </div>
            </td>
            <td>
              <div><%= shop.id %></div>
            </td>
            <td>
              <div><%= shop.name %></div>
              <div class="small text-muted">
                <%= formattime(shop.created_at, unit: "day") %>
              </div>
            </td>
            <td>
              <div><%= shop.phone %></div>
            </td>
            <td>
              <div><%= shop.level %></div>
            </td>
            <td>
              <div><%= i18n_enum shop, :state %></div>
            </td>
            <td>
              <div><a href="<%= admin_shop_shopers_path(shop) %>">管理</a></div>
            </td>
            <td class="text-center">
              <div class="item-action dropdown">
                <a href="javascript:void(0)" data-toggle="dropdown" class="icon"><i class="fe fe-more-vertical"></i></a>
                <div class="dropdown-menu dropdown-menu-right">
                  <a href="<%= reporter_admin_shop_path(shop) %>" class="dropdown-item"><i class="dropdown-icon fe fe-tag"></i> 对账报表 </a>
                  <a href="<%= admin_shop_path(shop) %>" class="dropdown-item"><i class="dropdown-icon fe fe-tag"></i> 查看 </a>
                  <a href="<%= edit_admin_shop_path(shop) %>" class="dropdown-item"><i class="dropdown-icon fe fe-tag"></i> 修改 </a>
                  <%= link_to admin_shop_path(shop), class: "dropdown-item", method: :delete do %>
                    <i class="dropdown-icon fe fe-edit-2"></i> 删除
                  <% end %>
                </div>
              </div>
            </td>
          </tr>
          <% end %>
        </tbody>
      </table>
      <div class="card-footer">
        <%= paginate @shops %>
      </div>
    </div>
  </div>
</div>